﻿using BestCode.Creds.Entities;
using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;

namespace BestCode.Creds.Data.Mappings
{
    public class EntityMapping : ClassMapping<EntityInfo>
    {
        public EntityMapping()
        {
            Table("Entity");
            Id(p => p.Id, map =>
            {
                map.Column("EntityId");
                map.Generator(Generators.Identity);
            });
            Property(p=> p.Code);
            Property(p => p.Name);
            Property(p => p.Description);
            Property(p => p.PicturesFolder);
            Property(p => p.CredentialCost);

            ManyToOne(p => p.AnverseFace, map => map.Column("AnverseTemplateId"));
            ManyToOne(p => p.ReverseFace, map => map.Column("ReverseTemplateId"));
            
        } 
    }
}
